package com.example.javaee_library.Service.Impl;/**
 * @author Miao-yongzheng
 * @create 2021-12-23 13:38
 */

import com.example.javaee_library.Entity.Book;
import com.example.javaee_library.Entity.action;
import com.example.javaee_library.Service.Appoint_Service;
import com.example.javaee_library.dao.AppointmentDao;
import com.example.javaee_library.exception.NoNumberException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description:
 * @author: 34911
 * @time: 2021/12/23 13:38
 */
@Service
public class Appoint_Servicelmpl implements Appoint_Service {
    @Autowired
    AppointmentDao appointmentDao;
    @Override
    public List<action> findAll(String Student_id) {
        System.out.println("查询了%"+Student_id+"%的记录");
        List<action> result = appointmentDao.Action_Bystudent_id('%'+Student_id+'%');
        System.out.println(result.get(0).getAppoint_Time());
        return result;
    }

    @Override
    public int delete(String id) {
       int back = appointmentDao.deleteaction(Integer.parseInt(id));
       if(back<=0)
       {
           throw new NoNumberException(221,"删除记录失败");
       }
       else
           return back;
    }
}
